﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MPSystem.Util;

namespace MPSystem.Views.ZCYL
{
    /// <summary>
    /// BigDataLineChart.xaml 的交互逻辑
    /// </summary>
    public partial class BigDataLineChart : Page
    {
        public BigDataLineChart()
        {
            InitializeComponent();
        }


        /// <summary>
        /// 附加信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnquery_Click(object sender, RoutedEventArgs e)
        {
            int ixs = int.Parse(xs.Text);
            int ids = int.Parse(ds.Text);
            int zds = int.Parse(zd.Text);
            int zxs = int.Parse(zx.Text);

            this.linechart.Children.Clear();
            DrawingCanvas dc = new DrawingCanvas();//定义一个画布
          
            List<string> x = new List<string>();  //X轴

            List<DoubleCollection> y = new List<DoubleCollection>();//Y轴（X和Y的数量个数必须一样）
 
            Random rd = new Random();
            for (int i = 0; i < ixs; i++)//画5条线
            {

                DoubleCollection yy = new DoubleCollection();
                x.Clear();
                for (int ii = 0; ii < ids; ii++)
                {
                    double a = rd.Next(1, 1000);
                    double b = rd.Next(1, 1000);
                    x.Add(ii + "aaa");
                    yy.Add(b);


                }

                y.Add(yy);
            }
            //rt[0] = 110;
            dc.yLinesCount = 15;//（X轴显示多少个，必须小于X轴数集个数）
            dc.LowLimitValue =(int)((400.0/1000)*zxs);
            dc.Lowtitle = "第一条线";
            dc.MaximitValue = (int)((400.0 / 1000 ) * zds);
            dc.Maxtitle = "第二条线";
            dc.clearData();
            dc.addData("test", 1, 1000, x, y);//标题，Y轴最小/Y轴最大/X/Y


            dc.YHeight = 400;//画布高度
            dc.CanvasWidth = 1000;//画布宽度
            dc.Polyline();//画
            DrawingLine dl = new DrawingLine(dc);//线和鼠标动作单独处理
            dl.Height = 400;
            dl.CanvasWidth = dc.CanvasWidth;
            this.linechart.Children.Add(dc);
            linechart.Children.Add(dl);
        }
    }

  

}
